package com.puzzlebazar.client.squaregrid.model;

import com.puzzlebazar.client.puzzle.model.Move;
import com.puzzlebazar.client.util.BoundInfo;
import com.puzzlebazar.client.util.Vec2i;

public interface ResizableGrid {

	/**
	 * @return The grid size
	 */
	public Vec2i getGridSize();	
	
	/**
	 * Change the size of the square grid. There is no guarantee on how the grid
	 * will be resized. The information contained in the model could be cleared or
	 * partially cleared. 
	 * The user should call notifyObserver() after this.
	 * 
	 * @param gridSize The new number of columns / rows
	 * @return The list of moves generated by this resize operation
	 * @throws Exception
	 */
	public Move resize( Vec2i gridSize ) throws Exception;
	
	/**
	 * Expands the square grid by adding columns to the left of the current grid. 
	 * If the passed delta is negative, then the grid will be contracted instead.
	 * The model should strive to maintain as much information as possible.
	 * The user should call notifyObserver() after this.
	 * 
	 * @param delta The number of columns to add (or to remove, if negative)
	 * @return The list of moves generated by this resize operation
	 * @throws Exception
	 */
	public Move expandLeft( int delta ) throws Exception;

	/**
	 * Expands the square grid by adding columns to the right of the current grid. 
	 * If the passed delta is negative, then the grid will be contracted instead.
	 * The model should strive to maintain as much information as possible.
	 * The user should call notifyObserver() after this.
	 * 
	 * @param delta The number of columns to add (or to remove, if negative)
	 * @return The list of moves generated by this resize operation
	 * @throws Exception
	 */
	public Move expandRight( int delta ) throws Exception;

	/**
	 * Expands the square grid by adding rows to the top of the current grid. 
	 * If the passed delta is negative, then the grid will be contracted instead.
	 * The model should strive to maintain as much information as possible
	 * The user should call notifyObserver() after this.
	 * 
	 * @param delta The number of rows to add (or to remove, if negative)
	 * @return The list of moves generated by this resize operation
	 * @throws Exception
	 */
	public Move expandTop( int delta ) throws Exception;

	/**
	 * Expands the square grid by adding rows to the bottom of the current grid. 
	 * If the passed delta is negative, then the grid will be contracted instead.
	 * The model should strive to maintain as much information as possible
	 * The user should call notifyObserver() after this.
	 * 
	 * @param delta The number of rows to add (or to remove, if negative)
	 * @return The list of moves generated by this resize operation
	 * @throws Exception
	 */
	public Move expandBottom( int delta ) throws Exception;


	/**
	 * Access the minimum and maximum size available fo this grid
	 * 
	 * @return Information on the minimum and maximum size, null if no bounds
	 */
	public BoundInfo getBoundInfo();
		
}
